package com.wzh.service;

import com.wzh.dao.Classdao;
import com.wzh.dao.Studentdao;
import com.wzh.pojo.Po.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import java.util.List;
@Service
public class Stuser {
	@Autowired
	private Studentdao studentdao;
	@Autowired
	private Classdao classdao;
	public List<Student> getstudent(int classid){
		List<Student> students = studentdao.getbyid(classid);
        return students;
	}
	@Transactional
	public int deletestudents(int ids,int classid){
		int i = classdao.changeClassPeople(-1, classid);

		return  studentdao.deleteids(ids);
	}
	@Transactional
	public int updatestudent(int[] ids,int classid){
		int i=ids.length;
		int i1 = classdao.changeClassPeople(i, classid);

     	return  studentdao.updateids(ids,classid);
	}

}
